/**
 * Copyright &copy; 2019-2022 <a href="https://gitee.com/rit/zx-pm">zx-pm</a> All rights reserved.
 */
package com.zx.pm.modules.zx.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zx.pm.common.persistence.Page;
import com.zx.pm.common.service.CrudService;
import com.zx.pm.common.utils.StringUtils;
import com.zx.pm.modules.zx.entity.TenderRequire;
import com.zx.pm.modules.zx.dao.TenderRequireDao;

/**
 * 标书制作注意事项Service
 * @author forest
 * @version 2019-01-13
 */
@Service
@Transactional(readOnly = true)
public class TenderRequireService extends CrudService<TenderRequireDao, TenderRequire> {

	public TenderRequire get(String id) {
		return super.get(id);
	}
	
	public TenderRequire getByLzdId(String LzdId) {
		TenderRequire entity = dao.getByLzdId(LzdId);
		if(entity != null) {
			String str = entity.getReviewIndex();
			if(StringUtils.isNotBlank(str)) {
				entity.setZbArray(str.split(","));
			}
		}
		return dao.getByLzdId(LzdId);
	}
	public List<TenderRequire> findList(TenderRequire tenderRequire) {
		return super.findList(tenderRequire);
	}
	
	public Page<TenderRequire> findPage(Page<TenderRequire> page, TenderRequire tenderRequire) {
		return super.findPage(page, tenderRequire);
	}
	
	@Transactional(readOnly = false)
	public void save(TenderRequire tenderRequire) {
		if(tenderRequire.getZbArray().length > 0) {
			tenderRequire.setReviewIndex(StringUtils.join(tenderRequire.getZbArray(), ","));
		}
		super.save(tenderRequire);
	}
	
	@Transactional(readOnly = false)
	public void delete(TenderRequire tenderRequire) {
		super.delete(tenderRequire);
	}
	
}